using System.Threading.Tasks;
using Crossborder.Core.Dto;
using Crossborder.Domian.Orders;

namespace Crossborder.Service.Orders
{
    public partial class OrderService
    {
        private async Task AddOrderDetail(List<ShoppingCartDto> carts, string orderMasterId)
        {
            var details = _Mapper.Map<List<OrderDetail>>(carts);
            foreach (var detail in details)
            {
                detail.OrderMasterGuid = orderMasterId;
                detail.OrderDetailGuid = Guid.NewGuid().ToString();
            }
            await _OrderDetailRepo.BatchInsertAsync(details);
        }
    }
}